<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<jsp:useBean id="con000" class="com.tpc.control.bean.Con000"
	scope="session" />
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
if (con000.getLogon() == null || !con000.getLogon())
	response.sendRedirect(basePath+"/con000/con000.faces");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<base href="<%=basePath%>">
	<title>CON-120: Reservation Form</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="./css/custom.css">
  <link rel="stylesheet" type="text/css" href="./css/template01.css">
</head>
  
<body>
<div id="wrapper">
    	
	<f:view>
	<f:loadBundle var="bundle"
				basename="com.tpc.control.message.ResourceBundle" />
				
	<div id="header">
			<p><h:outputText value="#{bundle.project_name}"/></p>		 	   
		</div>
        <div id="navigation">
        	<h:outputText value="CON-120: พิมพ์ฟอร์มข้อมูลใบจอง " styleClass="header2"/>
		</div>			
	<div id="content">
			
			<h:form id="con120Form">
			
				<rich:panel style="width: 700px">
			<table>
			<tr>
			<td>
			<h:outputText value="เลขที่ใบจอง"/>
			</td>
			<td>
			<h:inputText value="#{con120.start}"/><h:outputText value="ถึง" />
			</td>
			<td>
			<h:inputText value="#{con120.stop}"/>
			</td>
			</tr>
			<tr>
			<td>
	
			</td>
			
			<td>
			<h:commandButton action="submit" value="ค้นหา" actionListener="#{con120.search}"/>
			</td>
			</tr>
			<tr>
			<td colspan='2'>
				<h:outputText value="#{con120.currentReserveNo}" style="font-size: 18px; font-style: normal; font-weight: bold" />
			</td>		
			</tr>
			<tr>
			<td colspan='2'>
			<h:commandButton action="#{con110.go111}" image="/images/arrow-first.gif" value="" actionListener="#{con120.first}" /><h:commandButton action="#{con110.go111}" image="/images/arrow-previous.gif" value="" actionListener="#{con120.previous}" /><h:commandButton action="#{con110.go111}" image="/images/arrow-next.gif" value="" actionListener="#{con120.next}" /><h:commandButton action="#{con110.go111}" image="/images/arrow-last.gif" value="" actionListener="#{con120.last}" /></td>
			</tr>
			</table>
			<rich:dataTable  value="#{con120.selectedReportLists}" var="rep">
        <rich:column>
	        <f:facet name="header">
	        	<h:outputText value="ลำดับ"/> 
	        </f:facet>
	        <h:outputText value="#{rep.line}" />
        </rich:column>

        <rich:column>

                <f:facet name="header"><h:outputText value="รหัส com"/></f:facet>
			<h:outputText value="#{rep.materialNo}"/>
        </rich:column>
        <rich:column >
                <f:facet name="header"><h:outputText value="รหัส design"/></f:facet>
				<h:outputText value="#{rep.materialDesign}"/>       
        </rich:column>
		<rich:column>
                <f:facet name="header"><h:outputText value="แผนก"/></f:facet>
				<h:outputText value="#{rep.division}"/>
        </rich:column>
        <rich:column>

                <f:facet name="header"><h:outputText value="ปริมาณที่จอง"/></f:facet>
				<h:outputText value="#{rep.qty}"/>
        </rich:column>
               <rich:column>

		        <f:facet name="header"><h:outputText value="หน่วย"/></f:facet>
				<h:outputText value="#{rep.uom}"/>
                  
        </rich:column>
 
               <rich:column>

                <f:facet name="header"><h:outputText value="กำหนดส่ง"/></f:facet>
						<h:outputText value="#{rep.deliveryDate}"/>
                  
        </rich:column>
                       <rich:column>

                <f:facet name="header"><h:outputText value="สถานะใบจอง"/></f:facet>
						<h:outputText value="#{rep.status}"/>          
        </rich:column>
				</rich:dataTable>
				</rich:panel>
				<h:commandButton action="submit" value="Export to Excel" actionListener="#{con120.generateReport}"/>			
			</h:form>
		</div>
		<div id="footer">
				<h:form id="footerForm">
					<h:panelGrid columns="2" width="500px" styleClass="normal2">
					<h:panelGroup>
						<h:outputText value="#{bundle.current_user}" styleClass="headerSubject"/>
						<h:outputText value="#{con000.userName}"/>
					</h:panelGroup>
					<h:panelGroup>
					<h:commandLink value="Main Menu" action="con001" styleClass="header2"></h:commandLink>
					<h:outputText value="|"/>
					<h:commandLink value="Logoff" action="#{con000.logoff}" styleClass="header2"></h:commandLink>
					</h:panelGroup>
					</h:panelGrid>
				</h:form>	 
			</div>
				
	</f:view>
</div>
</body>
</html>